/*=============================================================================

  SYSTEM MANAGER DEVICE MODULE

  FILE: SYSmgr_DEV.cpp
  
  DESCRIPTION

    System Manager Device Interface Module Definition

  EXTERNALIZED FUNCTIONS

    
  Copyright (c) DaeSung Engineering Inc. All rights reserved.

=============================================================================*/
/*=============================================================================

                             EDIT HISTORY

  ---------  -------  -------------------------------------------------------
    when       who     what, where, why
  ---------  -------  -------------------------------------------------------
   06/28/03   nso4th   Version 0.1

=============================================================================*/

/*=============================================================================
  HEADER INCLUSION
=============================================================================*/
#include <SYSmgr.h>

/*=============================================================================
  LOCALIZED VARIABLE DEFINITION
=============================================================================*/

/*=============================================================================
  EXTERNALIZED FUNCTION DEFINITION
=============================================================================*/
/*---------------------------------------------------------
   ALLOCATION & RELEASE
---------------------------------------------------------*/
void SYSmgr::DEV_Alloc(void)
{
	HIO_Alloc();
	HAIO_Alloc();
	HMot_Alloc();
	HFg_Alloc();
	HCam_Alloc();
	m_devReset = FALSE;
}

void SYSmgr::DEV_Free(void)
{
	HIO_Free();
	HAIO_Free();
	HMot_Free();
	HFg_Free();
	HCam_Free();
}

/*---------------------------------------------------------
   DEVICE CONTROL ...... BASIC
---------------------------------------------------------*/
boolean SYSmgr::DEV_Init(void)
{
	if(State_MajCurrent() != IDL_S)
		return	FALSE;

	State_Change(DEV_S, DEV_IDL_S);
	State_SendCommand(DEVINIT_C, 0, 0);

	return	TRUE;
}

boolean SYSmgr::DEV_Close(void)
{
	if(m_devInit == FALSE)
		return	FALSE;

	if(State_MajCurrent() != IDL_S)
		return	FALSE;

	State_Change(DEV_S, DEV_IDL_S);
	State_SendCommand(DEVCLOSE_C, 0, 0);

	return	TRUE;
}

boolean SYSmgr::DEV_Reset(void)
{
	if(State_MajCurrent() != IDL_S)
		return	FALSE;

	State_Change(DEV_S, DEV_IDL_S);
	State_SendCommand(DEVRESET_C, 0, 0);

	return	TRUE;
}

/*--- END OF SYSmgr_DEV.cpp ---*/
